package jeni2.VCD;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class menuvcd extends ListActivity{

	@Override
	public void onCreate(Bundle icicle)
	{
		super.onCreate(icicle);
		
		String[] menu = new String[] {"Input VCD Data", "View VCD Data", "Back"};
		
		this.setListAdapter(new ArrayAdapter<String> (this, android.R.layout.simple_list_item_1, menu));
	}
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id)
	{
		super.onListItemClick(l, v, position, id);
		
		Object o = this.getListAdapter().getItem(position);
		String selection = o.toString();
		
		ShowSelection(selection);
		
	}
	
	protected void ShowSelection(String selection)
	{
		try
		{
			Intent i = null;
			if (selection.equals("Input VCD Data"))
			{
				i = new Intent(this, inputvcd.class);
			}
			else if (selection.equals("View VCD Data"))
			{
				i = new Intent(this, ViewVCD.class);
			}
			else if (selection.equals("Back"))
			{
				i = new Intent(this, menu.class);
			}
			
			startActivity(i);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}
